//
//  UIViewExt.m
//  JMDome_1
//
//  Created by ios on 15/6/16.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "UIViewExt.h"

@implementation UIView(ViewGeometry)

-(CGFloat)frameBottom
{
    return CGRectGetMaxY(self.frame);
}
-(void)setFrameBottom:(CGFloat)frameBottom{
    CGRect newRect = self.frame;
    newRect.origin.y = frameBottom - self.frame.size.height;
    self.frame = newRect;
}

-(CGFloat)frameHeight
{
    return CGRectGetHeight(self.frame);
}
-(void)setFrameHeight:(CGFloat)frameHeight{
    CGRect newRect = self.frame;
    newRect.size.height = frameHeight;
    self.frame =newRect;
}

-(CGFloat)frameLeft
{
    return self.frame.origin.x;
}
-(void)setFrameLeft:(CGFloat)frameLeft{
    CGRect newRect = self.frame;
    newRect.origin.x = frameLeft;
    self.frame = newRect;
}

-(CGFloat)frameRight
{
    return CGRectGetMaxX(self.frame);
}
-(void)setFrameRight:(CGFloat)frameRight{
    CGRect newRect =self.frame;
    newRect.origin.x = frameRight -self.frame.size.width;
    self.frame = newRect;
}

-(CGFloat)frameTop
{
    return self.frame.origin.y;
}

-(void)setFrameTop:(CGFloat)frameTop{
    CGRect newRect = self.frame;
    newRect.origin.y = frameTop;
    self.frame = newRect;
}

-(CGFloat)frameWidth
{
    return CGRectGetWidth(self.frame);
}

-(void)setFrameWidth:(CGFloat)frameWidth{
    CGRect newRect = self.frame;
    newRect.size.width =frameWidth;
    self.frame = newRect;
}

@end

@implementation UIView(gesture)

- (void)addTarget:(id)target action:(SEL) action{
   
    self.userInteractionEnabled = YES;
    if([target respondsToSelector:@selector(action)]){
        [target respondsToSelector:action];
    }
}

@end
